package spring01.aware;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MyApplicationContextAware implements ApplicationContextAware {
	/*private  ClassPathXmlApplicationContext context;*/
	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		/*this.context = (ClassPathXmlApplicationContext) applicationContext;
		//如果我在系统中能够拿到上下文容器对象，我是不是可以手动注册实体Bean
		//我们的电商项目---》秒杀的商品是不是只有在双十一，双十二的时候才需要使用，我平时不需要，所以不让他占据内存空间
		//
		this.context.getBeanFactory()
				.registerSingleton("msGoods","秒杀商品对象");

		//双十一一过
		this.context.getBeanFactory().destroyBean("msGoods","秒杀商品对象");*/
	}
}
